﻿
// Cut and paste the following Rule Handler blocks into individual Java files.

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Bcl> ::= <Commands>"    
})

/**
 * Rule handler for the BCL rule.
 */
public class RuleHandler0 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler0(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Commands> ::= <Command>"    
})

/**
 * Rule handler for the COMMANDS rule.
 */
public class RuleHandler1 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler1(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Commands> ::= <Command> <Commands>"    
})

/**
 * Rule handler for the COMMANDS2 rule.
 */
public class RuleHandler2 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler2(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Command> ::= Identifier <Objects>"    
})

/**
 * Rule handler for the COMMAND_IDENTIFIER rule.
 */
public class RuleHandler3 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler3(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Objects> ::= <Object>"    
})

/**
 * Rule handler for the OBJECTS rule.
 */
public class RuleHandler4 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler4(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Objects> ::= <Object> ',' <Objects>"    
})

/**
 * Rule handler for the OBJECTS_COMMA rule.
 */
public class RuleHandler5 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler5(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Object> ::= '{' '}'"    
})

/**
 * Rule handler for the OBJECT_LBRACE_RBRACE rule.
 */
public class RuleHandler6 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler6(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Object> ::= '{' <Members> '}'"    
})

/**
 * Rule handler for the OBJECT_LBRACE_RBRACE2 rule.
 */
public class RuleHandler7 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler7(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Members> ::= <Pair>"    
})

/**
 * Rule handler for the MEMBERS rule.
 */
public class RuleHandler8 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler8(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Members> ::= <Pair> ',' <Members>"    
})

/**
 * Rule handler for the MEMBERS_COMMA rule.
 */
public class RuleHandler9 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler9(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Pair> ::= String ':' <Value>"    
})

/**
 * Rule handler for the PAIR_STRING_COLON rule.
 */
public class RuleHandler10 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler10(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Array> ::= '[' ']'"    
})

/**
 * Rule handler for the ARRAY_LBRACKET_RBRACKET rule.
 */
public class RuleHandler11 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler11(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Array> ::= '[' <Elements> ']'"    
})

/**
 * Rule handler for the ARRAY_LBRACKET_RBRACKET2 rule.
 */
public class RuleHandler12 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler12(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Elements> ::= <Value>"    
})

/**
 * Rule handler for the ELEMENTS rule.
 */
public class RuleHandler13 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler13(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Elements> ::= <Value> ',' <Elements>"    
})

/**
 * Rule handler for the ELEMENTS_COMMA rule.
 */
public class RuleHandler14 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler14(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= String"    
})

/**
 * Rule handler for the VALUE_STRING rule.
 */
public class RuleHandler15 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler15(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= Number"    
})

/**
 * Rule handler for the VALUE_NUMBER rule.
 */
public class RuleHandler16 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler16(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= <Object>"    
})

/**
 * Rule handler for the VALUE rule.
 */
public class RuleHandler17 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler17(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= <Array>"    
})

/**
 * Rule handler for the VALUE2 rule.
 */
public class RuleHandler18 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler18(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= true"    
})

/**
 * Rule handler for the VALUE_TRUE rule.
 */
public class RuleHandler19 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler19(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= false"    
})

/**
 * Rule handler for the VALUE_FALSE rule.
 */
public class RuleHandler20 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler20(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================

//=========================================================================
//RULE HANDLER CLASS BEGINS ===============================================
//=========================================================================

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= null"    
})

/**
 * Rule handler for the VALUE_NULL rule.
 */
public class RuleHandler21 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler21(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

//=========================================================================
//RULE HANDLER CLASS ENDS =================================================
//=========================================================================



//=========================================================================
// MAIN PROGRAM SHELL BEGINS ==============================================
//=========================================================================

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.parser.GOLDParser;

/**
 * An interpreter for the (Untitled) language. Source files can be executed and parse
 * trees can be generated from the input stream.
 */
public class (Untitled) {
    
    /**
     * Executes a program written in (Untitled).
     * @param sourceCode to interpret
     * @param wantTree true if the parse tree should be generated
     * @return parse tree if generate parse tree open is set
     */
    public String executeProgram(String sourceCode, boolean wantTree) throws IOException {
        // Use the compiled grammar file inside the jar
        GOLDParser parser = new GOLDParser(
            new FileInputStream("(Untitled).egt"),             // compiled grammar table
            "(Untitled)",                                      // rule handler package (fully qualified package)
            true);                                         // trim reductions
        
        // Controls whether or not a parse tree is returned or the program executed.
        parser.setGenerateTree(wantTree);
        
        String tree = null;
        try {
            // Parse the source statements to see if it is syntactically correct
            boolean parsedWithoutError = parser.parseSourceStatements(sourceCode);

            // Holds the parse tree if setGenerateTree(true) was called
            tree = parser.getParseTree();
            
            // Either execute the code or print any error message
            if (parsedWithoutError) {
                parser.getCurrentReduction().execute();
            } else {
                System.out.println(parser.getErrorMessage());
            }
        } catch (ParserException e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }

        return tree;
    }

    /*----------------------------------------------------------------------------*/
    
    /**
     * Load a source file to be interpreted by the engine.  
     * @param filename of a source file
     * @return source code to be interpreted
     * @throws IOException 
     */
    public String loadSourceFile(String filename) throws IOException {
        File file = new File(filename);
        FileInputStream fis = new FileInputStream(file);
        byte[] buf = new byte[(int)file.length()];
        fis.read(buf);
        fis.close();
        return new String(buf);
    }
   
    /*----------------------------------------------------------------------------*/
    
    public static void main(String[] args) throws Exception {
        if (args.length > 0) {
            (Untitled) parser = new (Untitled)();
            String source = parser.loadSourceFile(args[0]);
            boolean wantTree = args.length > 1 && args[1].equalsIgnoreCase("-tree");
            String tree = parser.executeProgram(source, wantTree);
            if (wantTree) {
                System.out.println(tree);
            }
        } else {
            System.out.println("Usage: java -cp .;./goldengine.jar (Untitled) <sourcefile> [-tree]");
        }
    }
}
